<%@page import="java.net.URLDecoder"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="helpers.UrlHelper"%>
<%@page import="java.util.TreeMap"%>
<%
TreeMap check = (TreeMap) request.getAttribute("check");
String url = (String) request.getAttribute("url");
String type = (String) request.getAttribute("type");

//Set seo content
String title = "Encode/Decode HTML";
String description = "Url Encode/Decode web page is an online tool that encodes or decodes a string using URL Encoding.";
String ogurl = UrlHelper.getServerUrl(request) + "/tool/dns";
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<jsp:include page="/layouts/header.jsp">
	<jsp:param name="title" value="<%=title %>" />
    <jsp:param name="description" value="<%=description %>" />
    <jsp:param name="ogtitle" value="<%=title %>" />
    <jsp:param name="ogurl" value="<%=ogurl %>" />
    <jsp:param name="ogdescription" value="<%=description%>" />
</jsp:include>

			<div class="row-fluid">
            
            	<!-- tool detail
        		================================================== -->
            	<div class="span8">
                	<h3 class="toolName">Encode/Decode HTML</h3>
                    <p class="toolDesc">Url Encode/Decode web page is an online tool that encodes or decodes a string using URL Encoding.</p>
                    
                    <!-- form check
        			================================================== -->
                    <form method="get" action="" class="form-inline">
                    	<input type="text" placeholder="enter your domain name" class="input-xlarge"  value="<%=url != null ? url : "" %>" name="url" />
                        <button type="submit" class="btn btn-info">Submit</button>
                        <div class="radioGroup row-fluid content-center">
                        	<div class="span2">
                            	<p>Encode</p>
                            	<input type="radio" id="radio-1-1" name="type" value="encode" <%=type == null || type.equals("encode") ? "checked" : "" %> class="regular-radio" /><label for="radio-1-1"></label><br />
                            </div>
                        	<div class="span2">
                            	<p>Decode</p>
                            	<input type="radio" id="radio-1-2" name="type" value="decode" <%=type != null && type.equals("decode") ? "checked" : "" %> class="regular-radio" /><label for="radio-1-2"></label>
                            </div>
                        </div>
                    </form>
                    
                    <!-- result
        			================================================== -->
       				<% if (url != null && !url.isEmpty()) { %>
                    <div class="toolResult">
                    	<h4><%=type %> result: </h4>
                        <hr />
                    	<%=type.equalsIgnoreCase("encode") ? URLEncoder.encode(url) :  URLDecoder.decode(url) %>
                    	
                    </div>
                    <% } %>
                </div>                
                
                <jsp:include page="/elements/right.jsp" />
                
            </div>


<jsp:include page="/layouts/footer.jsp" />